package exttable.dbclasses;

import dbutils.DbUtils;
import exttable.SGTTestParametrs;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;


/**
 * Created by IntelliJ IDEA.
 * User: ADMIN
 * Date: 10.05.2011
 * Time: 9:55:09
 * To change this template use File | Settings | File Templates.
 */
public class GroupsSchemaVisitsId {
    private int groupsSchemaVisitsId;
    private int schemaVisitsId;
    private String dicTestTypeId;
    private String schemaVisitsName;

    public int getGroupsSchemaVisitsId() {
        return groupsSchemaVisitsId;
    }

    public void setGroupsSchemaVisitsId(int groupsSchemaVisitsId) {
        this.groupsSchemaVisitsId = groupsSchemaVisitsId;
    }

    public int getSchemaVisitsId() {
        return schemaVisitsId;
    }

    public void setSchemaVisitsId(int schemaVisitsId) {
        this.schemaVisitsId = schemaVisitsId;
    }

    public String getDicTestTypeId() {
        return dicTestTypeId;
    }

    public void setDicTestTypeId(String dicTestTypeId) {
        this.dicTestTypeId = dicTestTypeId;
    }

    public String getSchemaVisitsName() {
        return schemaVisitsName;
    }


    public void setSchemaVisitsName() {
       try{
            Connection conn= DbUtils.getDBConnectionGeneral();
            PreparedStatement ps=conn.prepareStatement("select * from schema_visits where schema_visits_id="+getSchemaVisitsId());
            ResultSet rs=ps.executeQuery();
            while (rs.next()){
                schemaVisitsName=rs.getString(SGTTestParametrs.getInstance().getCurrentLocal().getColumn());
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public GroupsSchemaVisitsId(){
       
    }

    @Override
    public String toString() {
        return schemaVisitsName;
    }
}
